package org.grayrabbit.cms.entity;

// Generated 2011-5-16 13:39:30 by Hibernate Tools 3.3.0.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.apache.commons.lang.StringUtils;
import org.hibernate.annotations.GenericGenerator;

/**
 * CmsTopic generated by hbm2java
 */
@Entity
@Table(name = "CMS_TOPIC")
public class Topic implements java.io.Serializable {

	private static final long serialVersionUID = 7994913062813286455L;
	private String topicId;
	private Site site;
	private String topicName;
	private Date endTime;
	private String topicStatus;
	private String keywords;
	private Boolean isEnable;
	private Date createTime;
	private String createLoginName;
	private String createRealName;
	private String updateLoginName;
	private String updateRealName;
	private Date updateTime;
	private String auditLoginName;
	private String auditRealName;
	private Date auditTime;
	private String publishLoginName;
	private Date publishTime;
	private String publishRealName;
	private String auditScope;
	private String topicIndexTpl;
	private String topicContextListTpl;
	private String topicContentTplSet;
	private String topicDefaultContentTpl;
	private String topicSimpleName;
	private Boolean isAudit;
	
	//二期
	private String auditOption;//审核意见 
	private String smallPictureSize; //小图片大小
	private String middlePictureSize;//中图片大小
	private String bigPictureSize;//大图片大小
	private String picType;//图片类型
	private String cartoonType;//动画类型
	private String videoType;//视频类型
	private String softWareType;//软件类型
	private Long pictureAdvice;//图片大小限制
	private Long cartoonAdvice;//动画大小限制
	private Long videoAdvice;//视频大小限制
	private Long softwareAdvice;//软件大小限制
	//end
	
	private Set<Content> contents = new HashSet<Content>(0);
	private Set<TopicContent> topicContents = new HashSet<TopicContent>(0); //该专题忽略的文章

	public Topic() {
	}

	public Topic(String topicId) {
		this.topicId = topicId;
	}

	@Id
	@Column(name = "TOPIC_ID", unique = true, nullable = false, length = 32)
	@GeneratedValue(generator = "paymentableGenerator")       
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid") 
	public String getTopicId() {
		return this.topicId;
	}

	public void setTopicId(String topicId) {
		this.topicId = topicId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SITE_ID")
	public Site getSite() {
		return this.site;
	}

	public void setSite(Site site) {
		this.site = site;
	}

	@Column(name = "TOPIC_NAME", length = 64)
	public String getTopicName() {
		return this.topicName;
	}

	public void setTopicName(String topicName) {
		this.topicName = topicName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "END_TIME", length = 7)
	public Date getEndTime() {
		return this.endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@Column(name = "TOPIC_STATUS", length = 32)
	public String getTopicStatus() {
		return this.topicStatus;
	}

	public void setTopicStatus(String topicStatus) {
		this.topicStatus = topicStatus;
	}

	@Column(name = "KEYWORDS", length = 256)
	public String getKeywords() {
		return this.keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	@Column(name = "IS_ENABLE", precision = 1, scale = 0)
	public Boolean getIsEnable() {
		return this.isEnable;
	}

	public void setIsEnable(Boolean isEnable) {
		this.isEnable = isEnable;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATE_TIME", length = 7)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "CREATE_LOGIN_NAME", length = 64)
	public String getCreateLoginName() {
		return this.createLoginName;
	}

	public void setCreateLoginName(String createLoginName) {
		this.createLoginName = createLoginName;
	}

	@Column(name = "CREATE_REAL_NAME", length = 64)
	public String getCreateRealName() {
		return this.createRealName;
	}

	public void setCreateRealName(String createRealName) {
		this.createRealName = createRealName;
	}

	@Column(name = "UPDATE_LOGIN_NAME", length = 64)
	public String getUpdateLoginName() {
		return this.updateLoginName;
	}

	public void setUpdateLoginName(String updateLoginName) {
		this.updateLoginName = updateLoginName;
	}

	@Column(name = "UPDATE_REAL_NAME", length = 64)
	public String getUpdateRealName() {
		return this.updateRealName;
	}

	public void setUpdateRealName(String updateRealName) {
		this.updateRealName = updateRealName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UPDATE_TIME", length = 7)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@Column(name = "AUDIT_LOGIN_NAME", length = 64)
	public String getAuditLoginName() {
		return this.auditLoginName;
	}

	public void setAuditLoginName(String auditLoginName) {
		this.auditLoginName = auditLoginName;
	}

	@Column(name = "AUDIT_REAL_NAME", length = 64)
	public String getAuditRealName() {
		return this.auditRealName;
	}

	public void setAuditRealName(String auditRealName) {
		this.auditRealName = auditRealName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "AUDIT_TIME", length = 7)
	public Date getAuditTime() {
		return this.auditTime;
	}

	public void setAuditTime(Date auditTime) {
		this.auditTime = auditTime;
	}

	@Column(name = "PUBLISH_LOGIN_NAME", length = 64)
	public String getPublishLoginName() {
		return this.publishLoginName;
	}

	public void setPublishLoginName(String publishLoginName) {
		this.publishLoginName = publishLoginName;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "PUBLISH_TIME", length = 7)
	public Date getPublishTime() {
		return this.publishTime;
	}

	public void setPublishTime(Date publishTime) {
		this.publishTime = publishTime;
	}

	@Column(name = "PUBLISH_REAL_NAME", length = 64)
	public String getPublishRealName() {
		return this.publishRealName;
	}

	public void setPublishRealName(String publishRealName) {
		this.publishRealName = publishRealName;
	}

	@Column(name = "AUDIT_SCOPE", length = 256)
	public String getAuditScope() {
		return this.auditScope;
	}

	public void setAuditScope(String auditScope) {
		this.auditScope = auditScope;
	}

	@Column(name = "TOPIC_INDEX_TPL", length = 256)
	public String getTopicIndexTpl() {
		return this.topicIndexTpl;
	}

	public void setTopicIndexTpl(String topicIndexTpl) {
		this.topicIndexTpl = topicIndexTpl;
	}

	@Column(name = "TOPIC_CONTEXT_LIST_TPL", length = 256)
	public String getTopicContextListTpl() {
		return this.topicContextListTpl;
	}

	public void setTopicContextListTpl(String topicContextListTpl) {
		this.topicContextListTpl = topicContextListTpl;
	}

	@Column(name = "TOPIC_CONTENT_TPL_SET", length = 4000)
	public String getTopicContentTplSet() {
		return this.topicContentTplSet;
	}

	public void setTopicContentTplSet(String topicContentTplSet) {
		this.topicContentTplSet = topicContentTplSet;
	}

	@Column(name = "TOPIC_DEFAULT_CONTENT_TPL", length = 256)
	public String getTopicDefaultContentTpl() {
		return this.topicDefaultContentTpl;
	}

	public void setTopicDefaultContentTpl(String topicDefaultContentTpl) {
		this.topicDefaultContentTpl = topicDefaultContentTpl;
	}

	@Column(name = "TOPIC_SIMPLE_NAME", length = 64)
	public String getTopicSimpleName() {
		return this.topicSimpleName;
	}

	public void setTopicSimpleName(String topicSimpleName) {
		this.topicSimpleName = topicSimpleName;
	}
	public Boolean getIsAudit() {
		return isAudit;
	}

	public void setIsAudit(Boolean isAudit) {
		this.isAudit = isAudit;
	}

	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "topic")
	public Set<TopicContent> getTopicContents() {
		return this.topicContents;
	}

	public void setTopicContents(Set<TopicContent> topicContents) {
		this.topicContents = topicContents;
	}
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "topic")
	public Set<Content> getContents() {
		return this.contents;
	}

	public void setContents(Set<Content> contents) {
		this.contents = contents;
	}
	
	@Transient
	public String getAuditName(){
		String names = getAuditRealName();
		if(StringUtils.isBlank(names))
			return null;
		String[] as=names.split(",");
		return as[0];
	}

	@Column(name = "AUDIT_OPINION", length = 512)
	public String getAuditOption() {
		return auditOption;
	}

	public void setAuditOption(String auditOption) {
		this.auditOption = auditOption;
	}
	@Column(name = "SMALL_PICTURE_SIZE", length = 64)
	public String getSmallPictureSize() {
		return smallPictureSize;
	}

	public void setSmallPictureSize(String smallPictureSize) {
		this.smallPictureSize = smallPictureSize;
	}
	@Column(name = "MIDDLE_PICTURE_SIZE", length = 64)
	public String getMiddlePictureSize() {
		return middlePictureSize;
	}

	public void setMiddlePictureSize(String middlePictureSize) {
		this.middlePictureSize = middlePictureSize;
	}
	@Column(name = "BIG_PICTURE_SIZE", length = 64)
	public String getBigPictureSize() {
		return bigPictureSize;
	}

	public void setBigPictureSize(String bigPictureSize) {
		this.bigPictureSize = bigPictureSize;
	}
	@Column(name = "PIC_TYPE", length = 64)
	public String getPicType() {
		return picType;
	}

	public void setPicType(String picType) {
		this.picType = picType;
	}
	@Column(name = "CARTOON_TYPE", length = 64)
	public String getCartoonType() {
		return cartoonType;
	}

	public void setCartoonType(String cartoonType) {
		this.cartoonType = cartoonType;
	}
	@Column(name = "VIDEO_TYPE", length = 64)
	public String getVideoType() {
		return videoType;
	}

	public void setVideoType(String videoType) {
		this.videoType = videoType;
	}
	@Column(name = "SOFTWARE_TYPE", length = 64)
	public String getSoftWareType() {
		return softWareType;
	}

	public void setSoftWareType(String softWareType) {
		this.softWareType = softWareType;
	}
	@Column(name = "PICTURE_ADVICE", precision = 11, scale = 0)  
	public Long getPictureAdvice() {
		return pictureAdvice;
	}

	public void setPictureAdvice(Long pictureAdvice) {
		this.pictureAdvice = pictureAdvice;
	}
	@Column(name = "CARTOON_ADVICE", precision = 11, scale = 0)
	public Long getCartoonAdvice() {
		return cartoonAdvice;
	}

	public void setCartoonAdvice(Long cartoonAdvice) {
		this.cartoonAdvice = cartoonAdvice;
	}
	@Column(name = "VIDEO_ADVICE", precision = 11, scale = 0)
	public Long getVideoAdvice() {
		return videoAdvice;
	}

	public void setVideoAdvice(Long videoAdvice) {
		this.videoAdvice = videoAdvice;
	}
	@Column(name = "SOFTWARE_ADVICE", precision = 11, scale = 0)
	public Long getSoftwareAdvice() {
		return softwareAdvice;
	}

	public void setSoftwareAdvice(Long softwareAdvice) {
		this.softwareAdvice = softwareAdvice;
	}
	
	

}
